<?php
error_reporting(E_ALL);
ini_set('display_errors', '1');
$arrayToReturn = array();
            
          
            $string = file_get_contents('imgAndLink.json');
            $json_a = json_decode($string, true);
            
            $folder=""; $i=0;
            foreach ($json_a as $key => $value) {
                if(trim($key) == 'folder') {
                    $folder=$value;
                                        var_dump($folder);

                }
                else                    
                    foreach ($value as $indexRow => $valueRow) {
                        $arrayToReturn[$i]['imgName']=$folder.$valueRow['nameImg'];
                        $arrayToReturn[$i]['linkImage']=$valueRow['linkImage'];
                        $i++;
                    }
                
            }
            
            var_dump( $arrayToReturn);
?>
